    <%import math%>
    %if scfg.get('PAGEMAKE') == 'CMS' :
    <nav id="global">
        <ul class="clearfix">
            <%m=0%>
            %for k,v in sorted(pages.items(),key=lambda x:int(x[1].get('IDX'))):
            %if v.get('PARENT') == '':
            <%m=m+1%>
            %endif
            %endfor
            %for k,v in sorted(pages.items(),key=lambda x:int(x[1].get('IDX'))):
            %if v.get('TYPE') == 'MENU':
            <li style="width:${round(100.0/m,2)}%;">
            %if v.get('LINK') == '':
            <a href="//${web.ctx.host}/${k}.html">${v.get("TITLE")}</a>
            %else:
            <a href="${v.get('LINK')}">${v.get("TITLE")}</a>
            %endif
            </li>
            %endif
            %endfor
        </ul>
        <%
            m=0
            if pages.get(id): 
                parent=pages[id].get('PARENT')
            else:
                parent=""
        %>
        %for k,v in sorted(pages.items(),key=lambda x:int(x[1].get('IDX'))):
        %if v.get('PARENT') == id :
        <%m=m+1%>
        %endif
        %endfor

        %if m == 0:
        %for k,v in sorted(pages.items(),key=lambda x:int(x[1].get('IDX'))):
        %if v.get('PARENT') == parent:
        <%m=m+1%>
        %endif
        %endfor
        %endif

    </nav>

    %if m != 0:
    <div id="submenu">
    <ul>
    %for k,v in sorted(pages.items(),key=lambda x:int(x[1].get('IDX'))):
    %if v.get('TYPE') == 'SUBMENU':
    %if v.get('PARENT') == id or parent == v.get('PARENT'):
    <li>
        %if v.get('LINK') == '':
        <a href="//${web.ctx.host}/${k}.html">${v.get("TITLE")}</a>
        %else:
        <a href="${v.get('LINK')}">${v.get("TITLE")}</a>
        %endif
    </li>
    %endif
    %endif
    %endfor
    </ul>
    </div>
    %endif

    %else:
    <%include file="_menu.html" />
    %endif




